<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>大连理工大学143级队信息统计平台</title>
    <link rel="stylesheet" href="/plugins/bootstrap/dist/css/bootstrap.min.css"/>
    <link rel="stylesheet" href="/index.css"/>
</head>
<body>
<div class="container">
    <div class="row">
        <div class="col-md-10 col-md-push-1 title">
            <h2>143级队信息统计</h2>
        </div>
    </div>
    <div class="row">
        <div class="col-md-8 col-md-push-2 main">
            <form action="">
                <div class="form-group">
                    <label class="bian-input-head">姓名</label>
                    <input id="name" type="text" class="form-control"  placeholder="姓名">
                </div>
                <div class="form-group">
                    <label class="bian-input-head">原户籍所在地</label>
                    <input id="oldadd" type="text" class="form-control"  placeholder="原户籍所在地">
                </div>
                <div class="form-group">
                    <label class="bian-input-head">现住址</label>
                    <input id="newadd" type="text" class="form-control"  placeholder="现住址">
                </div>
                <div class="form-group">
                    <label class="bian-input-head">户口是否迁入本地</label>
                    <div class="radio">
                        <label>
                            <input type="radio" name="change" value="1" checked>
                            是
                        </label>
                    </div>
                    <div class="radio">
                        <label>
                            <input type="radio" name="change" value="0">
                            否
                        </label>
                    </div>
                </div>
                <div class="form-group">
                    <label class="bian-input-head">联系电话</label>
                    <input id="phone" type="text" class="form-control"  placeholder="联系电话">
                </div>
                <div class="form-group">
                    <label class="bian-input-head">QQ号</label>
                    <input id="qq" type="text" class="form-control"  placeholder="QQ号">
                </div>
                <div class="form-group">
                    <label class="bian-input-head">微信号</label>
                    <input id="weixin" type="text" class="form-control"  placeholder="微信号">
                </div>
                <div class="form-group">
                    <label class="bian-input-head">常用邮箱</label>
                    <input id="mail" type="text" class="form-control"  placeholder="常用邮箱">
                </div>
                <div class="form-group">
                    <label class="bian-input-head">直系亲属姓名</label>
                    <input id="relative" type="text" class="form-control"  placeholder="直系亲属姓名">
                </div>
                <div class="form-group">
                    <label class="bian-input-head">与本人关系</label>
                    <input id="relation" type="text" class="form-control"  placeholder="与本人关系">
                </div>
                <div class="form-group">
                    <label class="bian-input-head">联系电话</label>
                    <input id="relphone" type="text" class="form-control"  placeholder="联系电话">
                </div>
                <div class="form-group">
                    <label class="bian-input-head">护照号码</label>
                    <input id="passport" type="text" class="form-control"  placeholder="护照号码">
                </div>
                <div class="form-group">
                    <button id="submit" type="button" class="form-control btn btn-danger">提交</button>
                </div>
            </form>
        </div>
    </div>
</div>
<script src="/plugins/jquery/dist/jquery.min.js"></script>
<script type="application/javascript">
    $('#submit').click(function(){
        var data = {};
        var name = $('#name').val();
        var oldadd = $('#oldadd').val();
        var newadd = $('#newadd').val();
        var change = $('input[name="change"]:checked').val();
        if(change == '1'){
            change = '是';
        }else{
            change = '否';
        }
        var phone = $('#phone').val();
        var qq = $('#qq').val();
        var weixin = $('#weixin').val();
        var mail = $('#mail').val();
        var relative = $('#relative').val();
        var relation = $('#relation').val();
        var relphone = $('#relphone').val();
        var passport= $('#passport').val();
        data = {
            name:name,
            oldadd:oldadd,
            newadd:newadd,
            change:change,
            phone:phone,
            qq:qq,
            weixin:weixin,
            mail:mail,
            relative:relative,
            relation:relation,
            relphone:relphone,
            passport:passport
        };
        $.ajax({
            url:'/data',
            type:'POST',
            data:data,
            success:function(data){
                if(data){
                    alert('提交成功');
                    location.reload(true);
                }else{
                    alert('提交失败');
                }
            }
        })
    });
</script>
</body>
</html>